<template>
  <div>
    详情 页面 id:{{$route.params.id}}
    <br/>
    <img :src="movie.img|formatimg" style="width:100px;height:150px;" /> 电影的名称：{{movie.nm}}

  </div>
</template>

<script>
import axios from "axios"
export default {
  layout:'detail',
  filters: {
    formatimg(url) {
      return url.replace("w.h", "110.150")
    }
  },
  async asyncData() {
    return axios
      .get("http://localhost:3003/api/movie")
      .then(res => {
        console.log("res:", res)
        return { movie: res.data }
      })
      .catch(e => {
        error({ statusCode: 404, message: "Post not found" })
      })
  }
}
</script>


